﻿using Island;

public class Location
{
    public float latitude; // 经度N 
    public float longitude; // 纬度E 

    public Location()
    {

    }

    public Location(float N, float E)
    {
        this.latitude = N;
        this.longitude = E;
    }

    /// <summary>
    /// Location转PBLocation
    /// </summary>
    public static Location FromPB(PBLocation pb)
    {
        Location loc = new Location();
        loc.latitude = pb.latitude;
        loc.longitude = pb.longitude;
        return loc;
    }

    /// <summary>
    /// 从PBLocation解析经纬度
    /// </summary>
    /// <param name="pb"></param>
    public void ParsePB(PBLocation pb)
    {
        this.latitude = pb.latitude;
        this.longitude = pb.longitude;
    }

    /// <summary>
    /// PBLocation转Location
    /// </summary>
    public PBLocation ToPB()
    {
        PBLocation pb = new PBLocation();
        pb.latitude = this.latitude;
        pb.longitude = this.longitude;
        return pb;
    }
}
